﻿cmake_minimum_required(VERSION 3.8)
project(imgspec)

# MSVC热重载配置
if(POLICY CMP0141)
  cmake_policy(SET CMP0141 NEW)
  set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT 
      "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,
         $<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,
         $<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()

# 创建可执行目标
add_executable(imgspec 
  imgimpl.cpp
  imgvisual.cpp )

# 设置C++标准
set_property(TARGET imgspec PROPERTY CXX_STANDARD 20)
set(CMAKE_SYSTEM_NAME Windows)

# OpenCV配置
include_directories("E:/Program Files/opencv/build/include")
link_directories("E:/Program Files/opencv/build/x64/vc16/lib")
find_library(OpenCV_LIBS NAMES opencv_world opencv_worldd 
             PATHS "E:/Program Files/opencv/build/x64/vc16/lib")
target_link_libraries(imgspec PRIVATE ${OpenCV_LIBS})

# Eigen配置
include_directories("E:/Program Files/eigen-3.4.0")

target_include_directories(imgspec PRIVATE
    "E:/Program Files/eigen-3.4.0"  # Eigen 路径
)


# 运行时DLL环境设置
set_target_properties(imgspec PROPERTIES
  VS_DEBUGGER_ENVIRONMENT "PATH=$ENV{PATH};
    E:/Program Files/opencv/build/x64/vc16/bin"
)